<?php
declare(ENCODING = 'utf-8');

/*
 * phpCR_IteratorInterface.php created on 14 avr. 08 
 * Author: Rodrigue Le Gall
 * 
 * This file is inspired by the project Typo3
 *
 * RPortal is an open source web based Content Management System
 * Copyright (C) 2002-2008  Rodrigue Le Gall
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

/**
 * An Iterator interface
 *
 * The methods next(), hasNext() and remove() as in java.util.Iterator
 * append() is something we though would be nice...
 * 
 * @package phpContentRepository
 * @RPInterface
 */
interface phpCR_IteratorInterface extends Iterator {

	/**
	 * Returns the next element. Commented as PHP dows not allow overriding methods from extended interfaces...
	 * 
	 * @return mixed
	 * @throws phpCR_NoSuchElementException if no next element exists
	 */
	//public function next();

	/**
	 * Returns true if the iteration has more elements.
	 * 
	 * This is an alias of valid().
	 * 
	 * @return boolean
	 */
	public function hasNext();

	/**
	 * Removes from the underlying collection the last element returned by the iterator.
	 * This method can be called only once per call to next. The behavior of an iterator
	 * is unspecified if the underlying collection is modified while the iteration is in
	 * progress in any way other than by calling this method.
	 * 
	 * @return void
	 * @throws IllegalStateException if the next method has not yet been called, or the remove method has already been called after the last call to the next method.
	 */
	public function remove();

	/**
	 * Append a new element to the iteration
	 * 
	 * @param mixed $element
	 * @return void
	 */
	public function append($element);
}